-----------------------------------------------------------------------------------------------------------------------------------------------
--Lex
-----------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------
--全局变量存储全局信息
-----------------------------------------------------------------------------------------------------------------------------------------
globalTableStandardCommandHandler={}
globalTableMacroCommandHandler={}
globalTableFunctionCommandHandler={}
-----------------------------------------------------------------------------------------------------------------------------------------
--CommandParseFunc
-----------------------------------------------------------------------------------------------------------------------------------------
if nil == globalScriptEmbled2C then
	require(globalStringCommandParseLua)
	require(globalStringCommandCMakeParseLua)
end
globalTableStandardCommandHandler["project"]=project_Parse
globalTableStandardCommandHandler["include"]=include_PreParse
globalTableStandardCommandHandler["set"]=set_PreParse
globalTableStandardCommandHandler["macro"]=macro_PreParse
globalTableStandardCommandHandler["if"]=ifControlCommandPreParseSection
globalTableStandardCommandHandler["add_subdirectory"]=add_subdirectoryParse
globalTableStandardCommandHandler["list"]=listControlCommandParse
globalTableStandardCommandHandler["include_directories"]=include_directoriesParse
globalTableStandardCommandHandler["link_directories"]=link_directoriesParse
globalTableStandardCommandHandler["add_library"]=add_libraryParse
globalTableStandardCommandHandler["add_executable"]=add_executableParse
globalTableStandardCommandHandler["target_link_libraries"]=target_link_librariesParse
globalTableStandardCommandHandler["add_definitions"]=add_definitionsParse
globalTableStandardCommandHandler["install"]=installParse

globalTableStandardCommandHandler["add_required_package"]=add_required_packageParse

--cmake dumy
globalTableStandardCommandHandler["cmake_minimum_required"]=cmake_minimum_requiredDumy

-----------------------------------------------------------------------------------------------------------------------------------------------
-- 开始 
-----------------------------------------------------------------------------------------------------------------------------------------------
function doAllLexFile()
	os.execute("llmkdir "..globalStrCurrentDir.."/LLMakeCach")
	local localTableTokenString = table.concat(globalTableTokenTable," ")
--	print(localTableTokenString)
	local localLexTable,globalStringErrorStr = nativeToolToken2Lex(localTableTokenString)
	if nil == localLexTable then
		os.exit(-1)
	end
	localLexTable = jointTokenYinHao(localLexTable)
	doAllLex(localLexTable,gTableParseTargetData)
--	debug_dump_Table("gTableParseTargetData",gTableParseTargetData)
	extractVariableOfParseTargetDataTable(gTableParseTargetData)
	gTableParseTargetData = reduceTableDepth(gTableParseTargetData)
--	debug_dump_Table("gTableParseTargetData",gTableParseTargetData)
end

if nil == globalScriptEmbled2C then
	doAllLexFile()
end
